package entity;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.validator.NotNull;

@Entity
public class BSCMetric {

	@Id
	@GeneratedValue
	private int id;
	
	@NotNull
	private String name;
	
	private String description;
	
	@NotNull
	private String targetValue;
	
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name="BSCGoal_BSCMetric", joinColumns=@JoinColumn(name="BSCMetric_id"), inverseJoinColumns=@JoinColumn(name="BSCGoal_id"))
	@Cascade({CascadeType.ALL})
	private List<BSCGoal> goals;
	
	@OneToMany(mappedBy="metric")
	@Cascade({CascadeType.ALL})
	private List<Measurement> measurements;

	public void setId(int id) {
		this.id = id;
	}

	public int getId() {
		return id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setGoals(List<BSCGoal> goals) {
		this.goals = goals;
	}

	public List<BSCGoal> getGoals() {
		return goals;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getDescription() {
		return description;
	}

	public void setTargetValue(String targetValue) {
		this.targetValue = targetValue;
	}

	public String getTargetValue() {
		return targetValue;
	}

	public void setMeasurements(List<Measurement> measurements) {
		this.measurements = measurements;
	}

	public List<Measurement> getMeasurements() {
		return measurements;
	}
}
